package com.itstyle.seckill.topic.desinger.design_xw.state;

/**
 * @Auther: liuwenxiang
 * @Date: 2019/9/18 23:23
 * @Description:
 * 状态模式有点类似模版方法，只是模版方法已经实现，根据不同的实现代表不同的状态
 */
public abstract class AbstractState {

    protected ScoreContext hj;

    protected  String stateName;

    protected  int score;

    public  abstract  void  checkState(); //检查当前状态

    public void addScore(int x){

        score=score+x;
        System.out.print("加上："+x+"分，\t当前分数："+score );
        checkState();
        System.out.println("分，\t当前状态："+hj.getState().stateName);
    }

}
